<template>
  <right-canvas-template :title="componentData.title" :tabName="componentData.tabName">
    <el-form class="right-panorama">
      <input-normal label="设计宽度" v-model="commonAttr.designWidth" @change="onChangeAttr"></input-normal>
      <input-normal label="设计高度" v-model="commonAttr.designHeight" @change="onChangeAttr"></input-normal>
      <switch-normal v-model="commonAttr.isFullScreen" label="全屏" @change="onChangeAttr"></switch-normal>
      <slider-normal v-model="commonAttr.camera.fov" label="视角" :max="90" :step="1" @change="onChangeAttr"></slider-normal>
      <input-normal v-model="commonAttr.camera.near" label="距离离摄影机近端" @change="onChangeAttr"></input-normal>
      <input-normal v-model="commonAttr.camera.far" label="距离摄影机远端" @change="onChangeAttr"></input-normal>
      <input-normal v-model="commonAttr.camera.position" label="摄影机位置(x,y,z)" @change="onChangeAttr"></input-normal>

      <color-normal v-model="commonAttr.scene.backgroundColor" label="背景颜色" format="rgb" @change="onChangeAttr"></color-normal>
      <color-normal v-model="commonAttr.light.hemi.skyColor" label="环境光天光" format="rgb" @change="onChangeAttr"></color-normal>
      <color-normal v-model="commonAttr.light.hemi.groundColor" label="环境光地面光" format="rgb" @change="onChangeAttr"></color-normal>
      <slider-normal v-model="commonAttr.light.hemi.intensity" label="环境光强度" :max="100" :step="1" @change="onChangeAttr"></slider-normal>

      <color-normal v-model="commonAttr.light.directional.color" label="平行光的颜色" format="rgb" @change="onChangeAttr"></color-normal>
      <slider-normal v-model="commonAttr.light.directional.intensity" label="平行光强度" :max="100" :step="1" @change="onChangeAttr"></slider-normal>
      <input-normal v-model="commonAttr.light.position" label="灯光位置(x,y,z)" @change="onChangeAttr"></input-normal>

      <add-img-con :url="commonAttr.url" comAttr="commonAttr" picAttr="url" :height="100" class="margin-left-right-16"></add-img-con>
      <input-normal label="全景图Url" v-model="commonAttr.url" @change="onChangeAttr"></input-normal>
      <textarea-normal label="全景图数据" placeholder="fullWidth,fullHeight,croppedWidth,croppedHeight,croppedX,croppedY" v-model="commonAttr.data" @change="onChangeAttr"></textarea-normal>
    </el-form>
  </right-canvas-template>
</template>

<script setup lang="ts">
import { useWebComponentStore } from '@/store/web/component'

const useWebComponent = useWebComponentStore()

let componentData_: any
const componentData = computed(() => {
  componentData_ = useWebComponent.currentComponentData
  return componentData_
})
let commonAttr_: any
const commonAttr = computed(() => {
  commonAttr_ = useWebComponent.currentComponentData!.commonAttr
  return commonAttr_
})
const onChangeAttr = () => {
  // useWebComponent.updateCurrentComponentData({ commonAttr: commonAttr_ })
}
</script>